package com.example.administrator.capital.mine;


import android.app.Fragment;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.example.administrator.capital.R;
import com.example.administrator.capital.base.BaseBackFragment;
import com.example.administrator.capital.utils.ToastUtil;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;

/**
 * A simple {@link Fragment} subclass.
 * 帮助中心
 */
public class HelpCenterFragment extends BaseBackFragment {

    Unbinder unbinder;
    @BindView(R.id.qq_1)
    TextView mQq1;
    @BindView(R.id.qq_2)
    TextView mQq2;
    private TextView mBack;

    public HelpCenterFragment() {
        // Required empty public constructor
    }

    public static HelpCenterFragment newInstance() {

        Bundle args = new Bundle();
        HelpCenterFragment fragment = new HelpCenterFragment();
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view = inflater.inflate(R.layout.fragment_help_center, container, false);
        unbinder = ButterKnife.bind(this, view);
        return view;
    }

    @Override
    protected void initView(View view) {
        super.initView(view);
        mBack = view.findViewById(R.id.app_title_back);
    }

    @Override
    protected void setListener() {
        super.setListener();
        mBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                _mActivity.onBackPressed();

            }
        });
        mQq1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                try {
                 String urlQQ = "mqqwpa://im/chat?chat_type=wpa&uin=3537509556&version=1";
                startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(urlQQ)));
              }catch (Exception e){
                    ToastUtil.showShort("你的手机没有安装QQ！");}
            }
        });
        mQq2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                try {
                    String urlQQ = "mqqwpa://im/chat?chat_type=wpa&uin=3525949105&version=1";
                    startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(urlQQ)));
                }catch (Exception e){
                    ToastUtil.showShort("你的手机没有安装QQ！");}
            }
        });
    }

    @Override
    protected void setData() {
        super.setData();
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }
}
